package com.qimu.saiyou.model.vo;

import com.qimu.saiyou.model.entity.QuestionBank;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 答案
 *
 * @TableName question_answer
 */
@Data
public class QuestionBankVo implements Serializable {
    private Long id;

    /**
     * 题库名称
     */
    private String title;
    protected long total;
    protected long size;
    protected long current;
    /**
     * 题库备注
     */
    private String remark;

    /**
     * 创建时间
     */
    private Date createTime;

    private List<QuestionVO> questionList;

    /**
     * 包装类转对象
     *
     * @param questionBankVo 问答
     * @return {@link QuestionBankVo}
     */
    public static QuestionBank voToObj(QuestionBankVo questionBankVo) {
        if (questionBankVo == null) {
            return null;
        }
        QuestionBank questionBank = new QuestionBank();
        BeanUtils.copyProperties(questionBankVo, questionBank);
        return questionBank;
    }

    /**
     * 对象转包装类
     *
     * @return
     */
    public static QuestionBankVo objToVo(QuestionBank questionBank) {
        if (questionBank == null) {
            return null;
        }
        QuestionBankVo questionAnswerVO = new QuestionBankVo();
        BeanUtils.copyProperties(questionBank, questionAnswerVO);
        return questionAnswerVO;
    }

    private static final long serialVersionUID = 1L;
}